import request from '@/config/axios'

export interface RoleVO {
  id?: number
  name: string
  code: string
  type: number
  remark: string
  dataScope?: number
  dataScopeDeptIds?: number[]
  status: number
  sort: number
  createTime?: string
}

export const getRoleSimpleList = async () => {
  return await request.get({ url: '/system/role/simple-list' })
}

export const getRolePage = async (params: PageParam) => {
  return await request.get({ url: '/system/role/page', params })
}

export const getRole = async (id: number) => {
  return await request.get({ url: '/system/role/get', params: { id } })
}

export const createRole = async (data: RoleVO) => {
  return await request.post({ url: '/system/role/create', data: data })
}

export const updateRole = async (data: RoleVO) => {
  return await request.post({ url: '/system/role/update', data: data })
}

export const deleteRole = async (id: number) => {
  return await request.delete({ url: '/system/role/delete', params: { id } })
}
